using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace TestWebServiceClient
{
    public partial class WebUserControlToggleButton : System.Web.UI.UserControl
    {
        // Summary:
        //     Specifies the direction in which to sort a list of items.
        public enum ToggleButtonState
        {
            On = 0,
            Off = 1,
        }
        public string onText;
        public string offText;

        public string OnText
        {
            get { return onText; }
            set { onText = value; }
        }
        public string OffText
        {
            get { return offText; }
            set { offText = value; }
        }

        
        public ToggleButtonState toggleState{
            get{
                if (ViewState["toggleState"] == null)
                    ViewState["toggleState"] = ToggleButtonState.On;
                return (ToggleButtonState)ViewState["toggleState"];
            }
            set { ViewState["toggleState"] = value; }
        }


        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void toggleButA_Click(object sender, EventArgs e)
        {
            if (this.toggleState == ToggleButtonState.On) {
                toggleState = ToggleButtonState.Off;
                toggleButA.Text = this.OffText;
            } else{
                toggleState = ToggleButtonState.On;
                toggleButA.Text = this.OnText;
            }
        }
    }
}